﻿<%@ Page Language="C#" MasterPageFile="~/SMSMasterPage.master" AutoEventWireup="true"
    CodeFile="groups.aspx.cs" Inherits="groups" Title="Untitled Page" %>

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <table width="100%">
        <tr>
            <td align="center">
                <h3>
                    View &amp; Edit Your Contact Groups</h3>
            </td>
        </tr>
    </table>
    <table width="100%" style="font-size:12px;">
        <tr>
            <td style="color: #FF0000">
                <b>Your Groups:</b>
            </td>
        </tr>
        <tr>
            <td>
                <asp:GridView ID="grdGroups" runat="server" BackColor="#CCCCCC" BorderColor="#999999"
                    BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2" ForeColor="Black"
                    AutoGenerateColumns="False" DataKeyNames="GroupId" AllowPaging="True" 
                    onpageindexchanging="grdGroups_PageIndexChanging">
                    <RowStyle BackColor="White" VerticalAlign="Middle" HorizontalAlign="Center" />
                    <Columns>
                        <asp:TemplateField HeaderText="GroupId" InsertVisible="False" SortExpression="GroupId"
                            Visible="False">
                            <EditItemTemplate>
                                <asp:Label ID="lblgrpidedit" runat="server" Text='<%# Eval("GroupId") %>'></asp:Label>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblgrpid" runat="server" Text='<%# Bind("GroupId") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="My Groups" SortExpression="GroupName">
                            <EditItemTemplate>
                                <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("GroupName") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lblGrpname" runat="server" Text='<%# Bind("GroupName") %>'></asp:Label>
                                &nbsp;
                                <asp:Label ID="lblTotalContacts" runat="server"></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="UserId" SortExpression="UserId" Visible="False">
                            <EditItemTemplate>
                                <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("UserId") %>'></asp:TextBox>
                            </EditItemTemplate>
                            <ItemTemplate>
                                <asp:Label ID="lbluserid" runat="server" Text='<%# Bind("UserId") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Send Text">
                            <ItemTemplate>
                                <asp:ImageButton ID="lmgbtnSendText" runat="server" 
                                    onclick="lmgbtnSendText_Click" ImageUrl="~/images/send_sms.png" Width="30px" Height="30px" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Edit Group">
                            <ItemTemplate>
                                <asp:ImageButton ID="imgbtnEditGroup" runat="server" 
                                    onclick="imgbtnEditGroup_Click" ImageUrl="~/images/editgroup.jpg" Width="30px" Height="30px" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Contacts">
                            <ItemTemplate>
                                <asp:ImageButton ID="imgbtnContacts" runat="server" 
                                    onclick="imgbtnContacts_Click" ImageUrl="~/images/contacts.jpg" Width="25px" Height="25px" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField HeaderText="Delete">
                            <ItemTemplate>
                                <asp:ImageButton ID="imgbtnDeleteGroup" runat="server" 
                                    ImageUrl="~/images/Delete-icon.png" onclick="imgbtnDeleteGroup_Click" />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <FooterStyle BackColor="#CCCCCC" />
                    <PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
                    <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:smsportalConnectionString %>"
                    SelectCommand="SELECT * FROM [tbl_group]"></asp:SqlDataSource>
            </td>
        </tr>
        <tr>
            <td>
                <table>
                    <tr>
                        <td>
                            <asp:Label ID="lblrecords" runat="server" Text="Per page records:"></asp:Label>
&nbsp;</td>
                        <td>
                            <asp:DropDownList ID="ddlGridPages" runat="server" AutoPostBack="True" 
                                onselectedindexchanged="ddlGridPages_SelectedIndexChanged">
                                <asp:ListItem>10</asp:ListItem>
                                <asp:ListItem>20</asp:ListItem>
                                <asp:ListItem>50</asp:ListItem>
                                <asp:ListItem>100</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                        <td>
                            <asp:Button ID="btnAddGroup" runat="server" Text="ADD A NEW GROUP" Style="margin-left: 30px;" />
                            <cc1:ModalPopupExtender ID="btnAddGroup_ModalPopupExtender" runat="server" 
                                DynamicServicePath="" Enabled="True" CancelControlID="LC" BackgroundCssClass="modalBg" PopupControlID="pnlGroupContacts" TargetControlID="btnAddGroup">
                            </cc1:ModalPopupExtender>
                        </td>
                        <td>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                <asp:Panel ID="pnlGroupContacts" runat="server" style="display:none;" CssClass="modalPanel" Width="300px">
                    <table width="100%">
                        <tr>
                            <td align="right" bgcolor="#024F79">
                                <asp:LinkButton ID="LC" runat="server" ForeColor="White">[ X ]</asp:LinkButton>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:UpdatePanel runat="server" ID="upd1">
                                    <ContentTemplate>
                                        <table width="100%">
                                            <tr>
                                                <td>
                                                    Group Name:
                                                </td>
                                                <td>
                                                    <asp:TextBox ID="txtGroupname" runat="server" Width="168px"></asp:TextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="2">
                                                    <asp:Label ID="lblMessage" runat="server"></asp:Label>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                </td>
                                                <td>
                                                    <asp:Button ID="btnSubmit" runat="server" Text="Submit" 
                                                        onclick="btnSubmit_Click" />
                                                </td>
                                            </tr>
                                        </table>
                                    </ContentTemplate>
                                </asp:UpdatePanel>
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            </td>
        </tr>
    </table>
</asp:Content>
